package com.rybbaby.tss.platform.sysHandleLog.service.imp;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

import com.rybbaby.tss.core.aop.db.IPersistenceRequestLog;
import com.rybbaby.tss.core.aop.db.RequestLogBean;
import com.rybbaby.tss.core.web.service.imp.BaseServiceImp;
import com.rybbaby.tss.platform.sysHandleLog.entity.SysHandleLog;
import com.rybbaby.tss.platform.sysHandleLog.service.ISysHandleLogService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @description 操作日志数据库操作服务实现
 * 
 * @author 谢进伟
 * 
 * @createDate 2016-12-13 上午10:53:51
 */
@Service
@Transactional
public class SysHandleLogServiceImp extends BaseServiceImp<SysHandleLog> implements ISysHandleLogService, IPersistenceRequestLog {
	
	@Override
	public List<Map<String , Object>> adminUserIdDatasource() {
		String sql1 = "SELECT id,username FROM wmp.sys_admin_user";
		List<Map<String , Object>> adminUserId_datasources = this.findForJdbc(sql1 , null);
		return adminUserId_datasources;
	}
	
	@Override
	public Serializable persistenceLog(RequestLogBean requestLog) {
		if(requestLog == null) {
			return null;
		}
		SysHandleLog shl = new SysHandleLog();
		BeanUtils.copyProperties(requestLog , shl);
		return this.save(shl);
	}
	
}
